package com.pioneer.cloudstorage.service;

import com.pioneer.cloudstorage.pojo.dto.ChangeFolderDTO;
import com.pioneer.cloudstorage.pojo.dto.CreateFolderDTO;
import com.pioneer.cloudstorage.pojo.dto.FileUploadDTO;
import com.pioneer.cloudstorage.pojo.entity.FileMetadata;
import com.pioneer.cloudstorage.pojo.entity.Result;
import com.pioneer.cloudstorage.pojo.vo.ResultUpload;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;

public interface FilesService {
    List<FileMetadata> list(Integer parentId);
    Result createFolder(CreateFolderDTO  createFolderDTO);

    ResultUpload uploadFile(FileUploadDTO fileUploadDTO, Long userId);
    String calculateFileMd5(MultipartFile file);
    boolean isDocumentFile(String mimeType);
    void asyncIndexFileContent(FileMetadata  fileMetadata);

    /**
     * 下载文件
     */
    void downloadFile(Long fileId, Long userId, HttpServletResponse response) throws IOException;
    /**
     * 根据文件ID和用户ID获取文件元数据
     */
    FileMetadata getFileMetadata(Long fileId, Long userId);

    Result updateFile(Long fileId, ChangeFolderDTO updateFileDTO, Long userId);

    Result deleteFile(Long fileId, Long userId);
}
